'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    const { INTEGER, STRING, DATE, ENUM, TEXT } = Sequelize;
    return queryInterface.createTable('role', {
      id: {
        type: INTEGER(20),
        primaryKey: true,
        autoIncrement: true
      },
      rolename: {
        type: STRING(30),
        allowNull: false,
        defaultValue: '',
        comment: '权限名',
        unique: true
      },
      sortnum: {
        type: STRING(30),
        allowNull: false,
        defaultValue: '',
        comment: '排序',
      },
      menuids: {
        type: STRING(160),
        allowNull: false,
        defaultValue: '',
        comment: '权限id(用逗号分割的字符串)'
      },
      created_time: DATE,
      updated_time: DATE,
      deleted_time: DATE
    });
  },

  down: async (queryInterface, Sequelize) => {
    return queryInterface.dropTable('role');
  }
};
